//买卖股票的最佳时机 II
//https://leetcode.cn/problems/best-time-to-buy-and-sell-stock-ii/description/?envType=study-plan-v2&envId=top-interview-150

class Solution {
public:
    int maxProfit(vector<int>& prices) 
    {
        int n = prices.size();
        int ret = 0;
        for(int i = 1; i < n; i++)
        {
            int tmp = prices[i] - prices[i - 1];
            if(tmp > 0) ret += tmp;
        }
        return ret;
    }
};